package o;

import android.content.Context;
import androidx.annotation.NonNull;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appgallery.foundation.application.pkgmanage.model.update.ApkUpgradeInfo;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import o.duc.e;

class dkl {

    public interface b {
        void ˏ(boolean z);
    }

    dkl() {
    }

    protected static void ॱ(@NonNull Context context, @NonNull BaseDistCardBean baseDistCardBean, @NonNull cke o_cke, @NonNull final b bVar) {
        SessionDownloadTask ˎ = dvt.ˏ().ˎ(baseDistCardBean.ॱـ());
        if (ˎ == null) {
            ApkUpgradeInfo ॱ = dug.ॱ(baseDistCardBean.ॱـ());
            if (ॱ != null && 1 == ॱ.ˏॱ()) {
                duc.ˊ(context, baseDistCardBean.ॱـ(), baseDistCardBean.v_(), new e() {
                    public void ˎ() {
                        bVar.ˏ(true);
                    }
                });
                return;
            } else if (ॱ == null || 1 != ॱ.ॱˋ()) {
                bVar.ˏ(false);
                if (!baseDistCardBean.ᐝॱ() || ebz.ॱ().ˎ(baseDistCardBean.ॱـ())) {
                    dss.ॱ().ˏ(context, czt.TYPE_UPDATE_BUTTON, o_cke);
                    return;
                }
                return;
            } else {
                duc.ˎ(context, true, new e() {
                    public void ˎ() {
                        bVar.ˏ(true);
                    }
                });
                return;
            }
        }
        Logger.e("UpdateAppUtil", "appTask is already exsit, packageName = " + ˎ.ˊˊ());
    }
}
